#pragma once
#include "addons\ScreenQuad.h"
#include <content\Shader.h>
#include <vector>
#include <utils\mtrand.h>
#include "collision\CollisionDetector.h"
#include <nodes\DynamicSpriteNode.h>

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
struct Asteroid {
	ds::Vec2 pos;
	ds::Sprite* sprite;
	int type;
	float timer;
	int size;
	int energy;
	ds::Vec2 velocity;
	ds::CDHandle handle;
	float angle;
};

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
class Asteroids {

typedef std::vector<Asteroid> AsteroidList;

public:
	Asteroids(ds::DynamicSpriteNode* spriteNode);
	~Asteroids() {}
	void loadContent(ds::ResManager& resourceManager);
	void update(float elapsed);	
	void startWave(uint32 max);
	void killAsteroid(uint32 index);
	Asteroid& getAsteroid(uint32 index);
private:
	// methods
	void spawnAsteroids(float elapsed);
	void createAsteroid(int type);
	//void splitAsteroid(int type,const ds::Vec2& pos);
	void addAsteroid(int type,const ds::Vec2& pos,float angle);
	//
	ds::CollisionDetector& m_CD;
	//ds::ScreenQuad* m_Shapes;
	MTRand_open rand;
	//ds::ResourceHandle m_ShaderHandle;
	//float m_Timer;
	//ds::Vec3 m_Position;
	ds::DynamicSpriteNode* m_Sprites;
	AsteroidList m_Asteroids;
	float m_SpawnTimer;	
	int m_TotalKills;
	int m_CurrentKills;
	int m_AsteroidCounter;
	int m_MaxAsteroids;
};

